-- GENERATED SPELL FOR [Arch Mage Xintor] --


function spell0_16977(pUnit, Event) --@Arcane Missiles,n/a--
pUnit:FullCastSpellOnTarget(15736,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 596, 1)
end

function spell1_16977(pUnit, Event) --@Blizzard,n/a--
pUnit:FullCastSpellOnTarget(29458,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 12000, 1)
end

function spell2_16977(pUnit, Event) --@Fireball,n/a--
pUnit:FullCastSpellOnTarget(29456,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 2000, 1)
end

function spell3_16977(pUnit, Event) --@Fireball,n/a--
pUnit:FullCastSpellOnTarget(20823,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 3000, 1)
end

function spell4_16977(pUnit, Event) --@Frostbolt,n/a--
pUnit:FullCastSpellOnTarget(29457,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 2000, 1)
end

function spell5_16977(pUnit, Event) --@Ice Barrier,Self--
pUnit:FullCastSpellOnTarget(33245,pUnit)
pUnit:RegisterEvent('Sorts_16977', 30338, 1)
end

function spell6_16977(pUnit, Event) --@Pyroblast,n/a--
pUnit:FullCastSpellOnTarget(29459,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16977', 5000, 1)
end

function Sorts_16977(pUnit, Event)
local choix_sorts_16977 = math.random(0, 6)
if choix_sorts_16977 == 0 then
pUnit:RegisterEvent('spell0_16977', 1, 1)
end
if choix_sorts_16977 == 1 then
pUnit:RegisterEvent('spell1_16977', 1, 1)
end
if choix_sorts_16977 == 2 then
pUnit:RegisterEvent('spell2_16977', 1, 1)
end
if choix_sorts_16977 == 3 then
pUnit:RegisterEvent('spell3_16977', 1, 1)
end
if choix_sorts_16977 == 4 then
pUnit:RegisterEvent('spell4_16977', 1, 1)
end
if choix_sorts_16977 == 5 then
pUnit:RegisterEvent('spell5_16977', 1, 1)
end
if choix_sorts_16977 == 6 then
pUnit:RegisterEvent('spell6_16977', 1, 1)
end
end

function mob16977_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_16977', math.random(1500, 3000), 1)
end

function mob16977_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16977_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16977_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(16977, 1, 'mob16977_Action')
RegisterUnitEvent(16977, 2, 'mob16977_Leave')
RegisterUnitEvent(16977, 3, 'mob16977_Kill')
RegisterUnitEvent(16977, 4, 'mob16977_Die')
